﻿<Window x:Class="UniversalDataConvertor.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:UniversalDataConvertor"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
    <Window.Resources>
        <local:ConvertorSetup x:Key="source"/>
    </Window.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
            <ColumnDefinition Width="3*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition Height="75"/>
        </Grid.RowDefinitions>
        <ListBox x:Name="Modes" Grid.Row="0" Grid.Column="0" SelectionMode="Single" SelectionChanged="Modes_SelectionChanged" ItemsSource="{Binding Source={StaticResource source}, Path=Modes}">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <StackPanel>
                       <TextBlock Text="{Binding Path=Name}"/>
                    </StackPanel>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
        <StackPanel Grid.Row="0" Grid.Column="1">
            <TextBlock Text="Источник:"/>
            <TextBox x:Name="FileDataSource" Cursor="Hand" Text="{Binding Path=Modes/FileDataSourceName, Mode=TwoWay}"/>
            <ListView x:Name="Items">
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal">
                            <ComboBox Name="FromField" ItemsSource="{Binding Path=FileFields, Mode=TwoWay}" MinWidth="100" Margin="0 0 10 0"/>
                            <ComboBox Name="ToField" ItemsSource="{Binding Path=DbFields, Mode=TwoWay}" MinWidth="100"/>
                        </StackPanel>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>
        </StackPanel>
    </Grid>
</Window>
